var baseurl= "http://47.105.122.163:13311/"
var iotbaseurlIP= "//47.105.122.163:10012/" ;
var iotbaseurl= "http:"+iotbaseurlIP ;
var ucode= localStorage.getItem("ucode") ;

// ----------------- 方法区-----------------------------------------------------
function getQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}

function decodeToken(token) {
	if (!token || token === "") {
		return null;
	}
	let parts = token.split(".");
	if (parts.length !== 3) {
		return null;
	}
	let decoded = Base64.decode(parts[1]);
	if (!decoded) {
		return null;
	}
	return JSON.parse(decoded);
}

/**
 * @time
 * @Func 将长整形时间 转换制定格式
 * @param time 长整形数值
 * @returns {String}
 * @Exp timeStamp2String("1464058102000","MM/dd hh:mm")
 */
function timeStamp2String(time,format){
	if(time == "" || time == null)
		return ;
	if(format==undefined || format == "")
		format = "yyyy/MM/dd hh:mm:ss";
    var datetime = new Date();
    datetime.setTime(time);
    return datetime.Format(format);
};

/**
 * @time
 * @Func 时间格式化
 * @FuncName Format
 * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
 */
Date.prototype.Format = function (fmt) {
	 var o = {
	     "M+": this.getMonth() + 1,
	     "d+": this.getDate(),
	     "h+": this.getHours(),
	     "m+": this.getMinutes(),
	     "s+": this.getSeconds(),
	     "q+": Math.floor((this.getMonth() + 3) / 3),
	     "S": this.getMilliseconds()
	 };
	 if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	 for (var k in o)
		 if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	 return fmt;
};

/**
 * 获取默认值
 */
function gdv(value,default_val){
	if(value!=undefined && value+''!=""  && value!='undefined'){
		return value ;
	}else{
		if(default_val != undefined)
			return default_val ;
		return "";
	}
};
/**
 * 判断空函数
 */
var util = {
	isEmpty: function(val){
		if(val==null || val == ''){
			return true ;
		}
		return false ;
	},
	isNotEmpty: function(val){
		if(val != null && val != ''){
			return true ;
		}
		return false ;
	}
}

// eslint-disable-next-line no-unused-vars
